{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "206cc2ec-63bc-4011-8ea3-dad72f5d7651",
   "metadata": {},
   "source": [
    "！！！每个小题在此都作为独立小题，不用上一题处理结果，每个题都在原文件基础上操作"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "14a75fdd-e6f8-4df8-aa69-f4b8d6033b77",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "1. 保留0.9及以上confidence"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "591dc763-be44-4e8b-94d9-2ee31753fabf",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "87442\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "from datetime import datetime\n",
    "\n",
    "data=pd.read_csv('gaze.csv')#读入数据\n",
    "data = np.array(data)\n",
    "data1 = []\n",
    "norm_pos_x = []\n",
    "norm_pos_y = []\n",
    "for item in data:\n",
    "    norm_pos_x.append(item[3])\n",
    "    norm_pos_y.append(item[4])\n",
    "    if item[2] >= 0.9:\n",
    "        data1.append(item)\n",
    "        \n",
    "\n",
    "print(len(data1))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "36f51fcc-ee06-498a-beb9-50f23456f417",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "2.求满足3sigma原则条数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "70f6fa2f-0046-40e6-ac6b-7749a6f178e8",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "mean_x:  0.41027307219360715   mean_y:  0.4383197272042566  sigma_x:  0.20952288499554622   sigma_y:  0.21608766177095567\n",
      "120036\n"
     ]
    }
   ],
   "source": [
    "data2 = []\n",
    "mean_x = np.mean(norm_pos_x)\n",
    "mean_y = np.mean(norm_pos_y)\n",
    "sigma_x = np.std(norm_pos_x)\n",
    "sigma_y = np.std(norm_pos_y)\n",
    "print('mean_x: ',mean_x,'  mean_y: ',mean_y,' sigma_x: ',sigma_x,'  sigma_y: ',sigma_y)\n",
    "for j in data:\n",
    "    if (j[3] >= mean_x - 3 * sigma_x) and  (j[3] <= mean_x + 3 * sigma_x) and (j[4] >= mean_y - 3 * sigma_y) and  (j[4] <= mean_y + 3 * sigma_y):\n",
    "        data2.append(j)\n",
    "print(len(data2))\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "46026483-5a21-4fb2-8ff9-137190302c94",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "3.转换时间戳"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "060e365a-b830-4db2-a4a9-58d9214120dc",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0         1970-01-02 08:29:10+776780\n",
      "1         1970-01-02 08:29:10+776790\n",
      "2         1970-01-02 08:29:10+779710\n",
      "3         1970-01-02 08:29:10+779760\n",
      "4         1970-01-02 08:29:10+787490\n",
      "                     ...            \n",
      "125259    1970-01-02 08:34:03+695600\n",
      "125260    1970-01-02 08:34:03+697570\n",
      "125261    1970-01-02 08:34:03+701580\n",
      "125262    1970-01-02 08:34:03+703610\n",
      "125263    1970-01-02 08:34:03+705570\n",
      "Name: gaze_timestamp, Length: 125264, dtype: object\n"
     ]
    }
   ],
   "source": [
    "data = pd.read_csv('gaze.csv') #读取文件\n",
    "pd.set_option('mode.chained_assignment', None)  #因直接在源文件操作会报错提醒，故改变设置\n",
    "for i in range(len(data)):\n",
    "    data['gaze_timestamp'][i]=str(datetime.fromtimestamp(data['gaze_timestamp'][i])).replace('.','+')\n",
    "print(data['gaze_timestamp'])\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e84be8dc-6528-4a1f-9e39-83534d2fca05",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "4.采样率"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "c50e5338-d2af-4845-a4f4-7490d5676367",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "427.6261135001366\n"
     ]
    }
   ],
   "source": [
    "data=pd.read_csv('gaze.csv')#读入数据\n",
    "data_list = []\n",
    "for i in data['gaze_timestamp']:\n",
    "    data_list.append(i)\n",
    "hz =len(data_list) / (float(data_list[len(data_list)-1]) - float(data_list[0]))\n",
    "print(hz)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7afe1386-79ab-449d-a85b-2221e0cde207",
   "metadata": {},
   "source": [
    "5.高帧率采集设备在采集每帧的时候需要打上时间戳，但是时间戳有误差，每一帧时间戳不是严格按照采样率，为了后期时序数据处理方便，将gaze_timestamp列按照100Hz的帧重新采样，输出处理后的数据集的前二十行数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "id": "8bdc02b6-38c6-40d9-b89c-a2d9e7c61e3e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>world_index</th>\n",
       "      <th>confidence</th>\n",
       "      <th>norm_pos_x</th>\n",
       "      <th>norm_pos_y</th>\n",
       "      <th>gaze_point_3d_x</th>\n",
       "      <th>gaze_point_3d_y</th>\n",
       "      <th>gaze_point_3d_z</th>\n",
       "      <th>eye_center0_3d_x</th>\n",
       "      <th>eye_center0_3d_y</th>\n",
       "      <th>eye_center0_3d_z</th>\n",
       "      <th>gaze_normal0_x</th>\n",
       "      <th>gaze_normal0_y</th>\n",
       "      <th>gaze_normal0_z</th>\n",
       "      <th>eye_center1_3d_x</th>\n",
       "      <th>eye_center1_3d_y</th>\n",
       "      <th>eye_center1_3d_z</th>\n",
       "      <th>gaze_normal1_x</th>\n",
       "      <th>gaze_normal1_y</th>\n",
       "      <th>gaze_normal1_z</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>gaze_timestamp</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1970-01-02 00:29:10.770000+00:00</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0.681690</td>\n",
       "      <td>0.437387</td>\n",
       "      <td>0.291906</td>\n",
       "      <td>-54.359308</td>\n",
       "      <td>103.262224</td>\n",
       "      <td>694.806989</td>\n",
       "      <td>-9.967464</td>\n",
       "      <td>14.998960</td>\n",
       "      <td>-20.037641</td>\n",
       "      <td>-0.061136</td>\n",
       "      <td>0.121556</td>\n",
       "      <td>0.984479</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1970-01-02 00:29:10.780000+00:00</th>\n",
       "      <td>1.0</td>\n",
       "      <td>0.584288</td>\n",
       "      <td>0.437978</td>\n",
       "      <td>0.307110</td>\n",
       "      <td>-42.813406</td>\n",
       "      <td>41.035419</td>\n",
       "      <td>10.103229</td>\n",
       "      <td>0.021691</td>\n",
       "      <td>14.999306</td>\n",
       "      <td>-20.025094</td>\n",
       "      <td>-0.014355</td>\n",
       "      <td>0.095046</td>\n",
       "      <td>0.987478</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.145087</td>\n",
       "      <td>0.230744</td>\n",
       "      <td>0.962137</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1970-01-02 00:29:10.790000+00:00</th>\n",
       "      <td>1.0</td>\n",
       "      <td>0.679988</td>\n",
       "      <td>0.494694</td>\n",
       "      <td>0.404853</td>\n",
       "      <td>1.979829</td>\n",
       "      <td>-20.040517</td>\n",
       "      <td>-292.334754</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>15.000000</td>\n",
       "      <td>-20.000000</td>\n",
       "      <td>0.065145</td>\n",
       "      <td>0.027374</td>\n",
       "      <td>0.997500</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.150232</td>\n",
       "      <td>0.224797</td>\n",
       "      <td>0.962738</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1970-01-02 00:29:10.800000+00:00</th>\n",
       "      <td>1.0</td>\n",
       "      <td>0.810370</td>\n",
       "      <td>0.494951</td>\n",
       "      <td>0.404822</td>\n",
       "      <td>1.859581</td>\n",
       "      <td>-19.717564</td>\n",
       "      <td>-287.721641</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>15.000000</td>\n",
       "      <td>-20.000000</td>\n",
       "      <td>0.066672</td>\n",
       "      <td>0.024890</td>\n",
       "      <td>0.997463</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.152198</td>\n",
       "      <td>0.229156</td>\n",
       "      <td>0.961410</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1970-01-02 00:29:10.810000+00:00</th>\n",
       "      <td>2.0</td>\n",
       "      <td>0.811268</td>\n",
       "      <td>0.494067</td>\n",
       "      <td>0.401053</td>\n",
       "      <td>2.204797</td>\n",
       "      <td>-20.676414</td>\n",
       "      <td>-290.218427</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>15.000000</td>\n",
       "      <td>-20.000000</td>\n",
       "      <td>0.064772</td>\n",
       "      <td>0.024500</td>\n",
       "      <td>0.997599</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.151952</td>\n",
       "      <td>0.234021</td>\n",
       "      <td>0.960284</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1970-01-02 00:29:10.820000+00:00</th>\n",
       "      <td>2.0</td>\n",
       "      <td>0.893564</td>\n",
       "      <td>0.493605</td>\n",
       "      <td>0.399335</td>\n",
       "      <td>2.409602</td>\n",
       "      <td>-21.335674</td>\n",
       "      <td>-294.369777</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>15.000000</td>\n",
       "      <td>-20.000000</td>\n",
       "      <td>0.063058</td>\n",
       "      <td>0.025140</td>\n",
       "      <td>0.997693</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.150413</td>\n",
       "      <td>0.234215</td>\n",
       "      <td>0.960478</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1970-01-02 00:29:10.830000+00:00</th>\n",
       "      <td>2.0</td>\n",
       "      <td>0.845289</td>\n",
       "      <td>0.493316</td>\n",
       "      <td>0.398559</td>\n",
       "      <td>2.512630</td>\n",
       "      <td>-21.451642</td>\n",
       "      <td>-293.704395</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>15.000000</td>\n",
       "      <td>-20.000000</td>\n",
       "      <td>0.062845</td>\n",
       "      <td>0.027284</td>\n",
       "      <td>0.997650</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.151138</td>\n",
       "      <td>0.233532</td>\n",
       "      <td>0.960531</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1970-01-02 00:29:10.840000+00:00</th>\n",
       "      <td>2.5</td>\n",
       "      <td>0.841835</td>\n",
       "      <td>0.492696</td>\n",
       "      <td>0.398804</td>\n",
       "      <td>2.767211</td>\n",
       "      <td>-21.566487</td>\n",
       "      <td>-295.993985</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>15.000000</td>\n",
       "      <td>-20.000000</td>\n",
       "      <td>0.061422</td>\n",
       "      <td>0.025921</td>\n",
       "      <td>0.997775</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.150791</td>\n",
       "      <td>0.233569</td>\n",
       "      <td>0.960577</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1970-01-02 00:29:10.850000+00:00</th>\n",
       "      <td>3.0</td>\n",
       "      <td>0.813601</td>\n",
       "      <td>0.492874</td>\n",
       "      <td>0.398257</td>\n",
       "      <td>2.711425</td>\n",
       "      <td>-21.777256</td>\n",
       "      <td>-297.274744</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>15.000000</td>\n",
       "      <td>-20.000000</td>\n",
       "      <td>0.061335</td>\n",
       "      <td>0.026011</td>\n",
       "      <td>0.997778</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.149916</td>\n",
       "      <td>0.233780</td>\n",
       "      <td>0.960662</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1970-01-02 00:29:10.860000+00:00</th>\n",
       "      <td>3.0</td>\n",
       "      <td>0.893743</td>\n",
       "      <td>0.492674</td>\n",
       "      <td>0.398524</td>\n",
       "      <td>2.798286</td>\n",
       "      <td>-21.804480</td>\n",
       "      <td>-298.433361</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>15.000000</td>\n",
       "      <td>-20.000000</td>\n",
       "      <td>0.060777</td>\n",
       "      <td>0.025339</td>\n",
       "      <td>0.997830</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.149606</td>\n",
       "      <td>0.233583</td>\n",
       "      <td>0.960758</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1970-01-02 00:29:10.870000+00:00</th>\n",
       "      <td>3.5</td>\n",
       "      <td>0.862389</td>\n",
       "      <td>0.492139</td>\n",
       "      <td>0.398724</td>\n",
       "      <td>3.005405</td>\n",
       "      <td>-21.779999</td>\n",
       "      <td>-298.687613</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>15.000000</td>\n",
       "      <td>-20.000000</td>\n",
       "      <td>0.059995</td>\n",
       "      <td>0.025130</td>\n",
       "      <td>0.997882</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.150185</td>\n",
       "      <td>0.233384</td>\n",
       "      <td>0.960716</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1970-01-02 00:29:10.880000+00:00</th>\n",
       "      <td>4.0</td>\n",
       "      <td>0.909481</td>\n",
       "      <td>0.492167</td>\n",
       "      <td>0.398878</td>\n",
       "      <td>2.999809</td>\n",
       "      <td>-21.784091</td>\n",
       "      <td>-299.197961</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>15.000000</td>\n",
       "      <td>-20.000000</td>\n",
       "      <td>0.059907</td>\n",
       "      <td>0.024893</td>\n",
       "      <td>0.997893</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.149901</td>\n",
       "      <td>0.233191</td>\n",
       "      <td>0.960808</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1970-01-02 00:29:10.890000+00:00</th>\n",
       "      <td>4.0</td>\n",
       "      <td>0.855971</td>\n",
       "      <td>0.491731</td>\n",
       "      <td>0.398142</td>\n",
       "      <td>3.184321</td>\n",
       "      <td>-22.067007</td>\n",
       "      <td>-300.892163</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>15.000000</td>\n",
       "      <td>-20.000000</td>\n",
       "      <td>0.058900</td>\n",
       "      <td>0.024917</td>\n",
       "      <td>0.997953</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.149639</td>\n",
       "      <td>0.233584</td>\n",
       "      <td>0.960753</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1970-01-02 00:29:10.900000+00:00</th>\n",
       "      <td>4.0</td>\n",
       "      <td>0.850346</td>\n",
       "      <td>0.491440</td>\n",
       "      <td>0.398221</td>\n",
       "      <td>3.300165</td>\n",
       "      <td>-22.075103</td>\n",
       "      <td>-301.234553</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>15.000000</td>\n",
       "      <td>-20.000000</td>\n",
       "      <td>0.058422</td>\n",
       "      <td>0.024264</td>\n",
       "      <td>0.997997</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.149847</td>\n",
       "      <td>0.233968</td>\n",
       "      <td>0.960627</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1970-01-02 00:29:10.910000+00:00</th>\n",
       "      <td>5.0</td>\n",
       "      <td>0.878314</td>\n",
       "      <td>0.491522</td>\n",
       "      <td>0.397330</td>\n",
       "      <td>3.278969</td>\n",
       "      <td>-22.336895</td>\n",
       "      <td>-302.166428</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>15.000000</td>\n",
       "      <td>-20.000000</td>\n",
       "      <td>0.058302</td>\n",
       "      <td>0.025038</td>\n",
       "      <td>0.997985</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.149284</td>\n",
       "      <td>0.234162</td>\n",
       "      <td>0.960668</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1970-01-02 00:29:10.920000+00:00</th>\n",
       "      <td>5.0</td>\n",
       "      <td>0.864336</td>\n",
       "      <td>0.491490</td>\n",
       "      <td>0.396538</td>\n",
       "      <td>3.308013</td>\n",
       "      <td>-22.621279</td>\n",
       "      <td>-303.673027</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>15.000000</td>\n",
       "      <td>-20.000000</td>\n",
       "      <td>0.057891</td>\n",
       "      <td>0.025402</td>\n",
       "      <td>0.997999</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.148602</td>\n",
       "      <td>0.234394</td>\n",
       "      <td>0.960717</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1970-01-02 00:29:10.930000+00:00</th>\n",
       "      <td>5.0</td>\n",
       "      <td>0.998242</td>\n",
       "      <td>0.491106</td>\n",
       "      <td>0.396239</td>\n",
       "      <td>3.462726</td>\n",
       "      <td>-22.723509</td>\n",
       "      <td>-304.165507</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>15.000000</td>\n",
       "      <td>-20.000000</td>\n",
       "      <td>0.057256</td>\n",
       "      <td>0.025568</td>\n",
       "      <td>0.998032</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.148867</td>\n",
       "      <td>0.234479</td>\n",
       "      <td>0.960655</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1970-01-02 00:29:10.940000+00:00</th>\n",
       "      <td>5.6</td>\n",
       "      <td>0.822405</td>\n",
       "      <td>0.491349</td>\n",
       "      <td>0.396675</td>\n",
       "      <td>3.365049</td>\n",
       "      <td>-22.609107</td>\n",
       "      <td>-303.908032</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>15.000000</td>\n",
       "      <td>-20.000000</td>\n",
       "      <td>0.057648</td>\n",
       "      <td>0.025339</td>\n",
       "      <td>0.998015</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.148678</td>\n",
       "      <td>0.234164</td>\n",
       "      <td>0.960761</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1970-01-02 00:29:10.950000+00:00</th>\n",
       "      <td>6.0</td>\n",
       "      <td>0.837220</td>\n",
       "      <td>0.491234</td>\n",
       "      <td>0.397143</td>\n",
       "      <td>3.410404</td>\n",
       "      <td>-22.507586</td>\n",
       "      <td>-303.923452</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>15.000000</td>\n",
       "      <td>-20.000000</td>\n",
       "      <td>0.057488</td>\n",
       "      <td>0.024511</td>\n",
       "      <td>0.998045</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.148821</td>\n",
       "      <td>0.234277</td>\n",
       "      <td>0.960712</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1970-01-02 00:29:10.960000+00:00</th>\n",
       "      <td>6.0</td>\n",
       "      <td>0.860573</td>\n",
       "      <td>0.490922</td>\n",
       "      <td>0.397230</td>\n",
       "      <td>3.540623</td>\n",
       "      <td>-22.548167</td>\n",
       "      <td>-304.725183</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>15.000000</td>\n",
       "      <td>-20.000000</td>\n",
       "      <td>0.056879</td>\n",
       "      <td>0.024088</td>\n",
       "      <td>0.998090</td>\n",
       "      <td>-39.934928</td>\n",
       "      <td>14.997919</td>\n",
       "      <td>-20.075283</td>\n",
       "      <td>-0.148850</td>\n",
       "      <td>0.234256</td>\n",
       "      <td>0.960712</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                  world_index  confidence  norm_pos_x  \\\n",
       "gaze_timestamp                                                          \n",
       "1970-01-02 00:29:10.770000+00:00          0.0    0.681690    0.437387   \n",
       "1970-01-02 00:29:10.780000+00:00          1.0    0.584288    0.437978   \n",
       "1970-01-02 00:29:10.790000+00:00          1.0    0.679988    0.494694   \n",
       "1970-01-02 00:29:10.800000+00:00          1.0    0.810370    0.494951   \n",
       "1970-01-02 00:29:10.810000+00:00          2.0    0.811268    0.494067   \n",
       "1970-01-02 00:29:10.820000+00:00          2.0    0.893564    0.493605   \n",
       "1970-01-02 00:29:10.830000+00:00          2.0    0.845289    0.493316   \n",
       "1970-01-02 00:29:10.840000+00:00          2.5    0.841835    0.492696   \n",
       "1970-01-02 00:29:10.850000+00:00          3.0    0.813601    0.492874   \n",
       "1970-01-02 00:29:10.860000+00:00          3.0    0.893743    0.492674   \n",
       "1970-01-02 00:29:10.870000+00:00          3.5    0.862389    0.492139   \n",
       "1970-01-02 00:29:10.880000+00:00          4.0    0.909481    0.492167   \n",
       "1970-01-02 00:29:10.890000+00:00          4.0    0.855971    0.491731   \n",
       "1970-01-02 00:29:10.900000+00:00          4.0    0.850346    0.491440   \n",
       "1970-01-02 00:29:10.910000+00:00          5.0    0.878314    0.491522   \n",
       "1970-01-02 00:29:10.920000+00:00          5.0    0.864336    0.491490   \n",
       "1970-01-02 00:29:10.930000+00:00          5.0    0.998242    0.491106   \n",
       "1970-01-02 00:29:10.940000+00:00          5.6    0.822405    0.491349   \n",
       "1970-01-02 00:29:10.950000+00:00          6.0    0.837220    0.491234   \n",
       "1970-01-02 00:29:10.960000+00:00          6.0    0.860573    0.490922   \n",
       "\n",
       "                                  norm_pos_y  gaze_point_3d_x  \\\n",
       "gaze_timestamp                                                  \n",
       "1970-01-02 00:29:10.770000+00:00    0.291906       -54.359308   \n",
       "1970-01-02 00:29:10.780000+00:00    0.307110       -42.813406   \n",
       "1970-01-02 00:29:10.790000+00:00    0.404853         1.979829   \n",
       "1970-01-02 00:29:10.800000+00:00    0.404822         1.859581   \n",
       "1970-01-02 00:29:10.810000+00:00    0.401053         2.204797   \n",
       "1970-01-02 00:29:10.820000+00:00    0.399335         2.409602   \n",
       "1970-01-02 00:29:10.830000+00:00    0.398559         2.512630   \n",
       "1970-01-02 00:29:10.840000+00:00    0.398804         2.767211   \n",
       "1970-01-02 00:29:10.850000+00:00    0.398257         2.711425   \n",
       "1970-01-02 00:29:10.860000+00:00    0.398524         2.798286   \n",
       "1970-01-02 00:29:10.870000+00:00    0.398724         3.005405   \n",
       "1970-01-02 00:29:10.880000+00:00    0.398878         2.999809   \n",
       "1970-01-02 00:29:10.890000+00:00    0.398142         3.184321   \n",
       "1970-01-02 00:29:10.900000+00:00    0.398221         3.300165   \n",
       "1970-01-02 00:29:10.910000+00:00    0.397330         3.278969   \n",
       "1970-01-02 00:29:10.920000+00:00    0.396538         3.308013   \n",
       "1970-01-02 00:29:10.930000+00:00    0.396239         3.462726   \n",
       "1970-01-02 00:29:10.940000+00:00    0.396675         3.365049   \n",
       "1970-01-02 00:29:10.950000+00:00    0.397143         3.410404   \n",
       "1970-01-02 00:29:10.960000+00:00    0.397230         3.540623   \n",
       "\n",
       "                                  gaze_point_3d_y  gaze_point_3d_z  \\\n",
       "gaze_timestamp                                                       \n",
       "1970-01-02 00:29:10.770000+00:00       103.262224       694.806989   \n",
       "1970-01-02 00:29:10.780000+00:00        41.035419        10.103229   \n",
       "1970-01-02 00:29:10.790000+00:00       -20.040517      -292.334754   \n",
       "1970-01-02 00:29:10.800000+00:00       -19.717564      -287.721641   \n",
       "1970-01-02 00:29:10.810000+00:00       -20.676414      -290.218427   \n",
       "1970-01-02 00:29:10.820000+00:00       -21.335674      -294.369777   \n",
       "1970-01-02 00:29:10.830000+00:00       -21.451642      -293.704395   \n",
       "1970-01-02 00:29:10.840000+00:00       -21.566487      -295.993985   \n",
       "1970-01-02 00:29:10.850000+00:00       -21.777256      -297.274744   \n",
       "1970-01-02 00:29:10.860000+00:00       -21.804480      -298.433361   \n",
       "1970-01-02 00:29:10.870000+00:00       -21.779999      -298.687613   \n",
       "1970-01-02 00:29:10.880000+00:00       -21.784091      -299.197961   \n",
       "1970-01-02 00:29:10.890000+00:00       -22.067007      -300.892163   \n",
       "1970-01-02 00:29:10.900000+00:00       -22.075103      -301.234553   \n",
       "1970-01-02 00:29:10.910000+00:00       -22.336895      -302.166428   \n",
       "1970-01-02 00:29:10.920000+00:00       -22.621279      -303.673027   \n",
       "1970-01-02 00:29:10.930000+00:00       -22.723509      -304.165507   \n",
       "1970-01-02 00:29:10.940000+00:00       -22.609107      -303.908032   \n",
       "1970-01-02 00:29:10.950000+00:00       -22.507586      -303.923452   \n",
       "1970-01-02 00:29:10.960000+00:00       -22.548167      -304.725183   \n",
       "\n",
       "                                  eye_center0_3d_x  eye_center0_3d_y  \\\n",
       "gaze_timestamp                                                         \n",
       "1970-01-02 00:29:10.770000+00:00         -9.967464         14.998960   \n",
       "1970-01-02 00:29:10.780000+00:00          0.021691         14.999306   \n",
       "1970-01-02 00:29:10.790000+00:00         20.000000         15.000000   \n",
       "1970-01-02 00:29:10.800000+00:00         20.000000         15.000000   \n",
       "1970-01-02 00:29:10.810000+00:00         20.000000         15.000000   \n",
       "1970-01-02 00:29:10.820000+00:00         20.000000         15.000000   \n",
       "1970-01-02 00:29:10.830000+00:00         20.000000         15.000000   \n",
       "1970-01-02 00:29:10.840000+00:00         20.000000         15.000000   \n",
       "1970-01-02 00:29:10.850000+00:00         20.000000         15.000000   \n",
       "1970-01-02 00:29:10.860000+00:00         20.000000         15.000000   \n",
       "1970-01-02 00:29:10.870000+00:00         20.000000         15.000000   \n",
       "1970-01-02 00:29:10.880000+00:00         20.000000         15.000000   \n",
       "1970-01-02 00:29:10.890000+00:00         20.000000         15.000000   \n",
       "1970-01-02 00:29:10.900000+00:00         20.000000         15.000000   \n",
       "1970-01-02 00:29:10.910000+00:00         20.000000         15.000000   \n",
       "1970-01-02 00:29:10.920000+00:00         20.000000         15.000000   \n",
       "1970-01-02 00:29:10.930000+00:00         20.000000         15.000000   \n",
       "1970-01-02 00:29:10.940000+00:00         20.000000         15.000000   \n",
       "1970-01-02 00:29:10.950000+00:00         20.000000         15.000000   \n",
       "1970-01-02 00:29:10.960000+00:00         20.000000         15.000000   \n",
       "\n",
       "                                  eye_center0_3d_z  gaze_normal0_x  \\\n",
       "gaze_timestamp                                                       \n",
       "1970-01-02 00:29:10.770000+00:00        -20.037641       -0.061136   \n",
       "1970-01-02 00:29:10.780000+00:00        -20.025094       -0.014355   \n",
       "1970-01-02 00:29:10.790000+00:00        -20.000000        0.065145   \n",
       "1970-01-02 00:29:10.800000+00:00        -20.000000        0.066672   \n",
       "1970-01-02 00:29:10.810000+00:00        -20.000000        0.064772   \n",
       "1970-01-02 00:29:10.820000+00:00        -20.000000        0.063058   \n",
       "1970-01-02 00:29:10.830000+00:00        -20.000000        0.062845   \n",
       "1970-01-02 00:29:10.840000+00:00        -20.000000        0.061422   \n",
       "1970-01-02 00:29:10.850000+00:00        -20.000000        0.061335   \n",
       "1970-01-02 00:29:10.860000+00:00        -20.000000        0.060777   \n",
       "1970-01-02 00:29:10.870000+00:00        -20.000000        0.059995   \n",
       "1970-01-02 00:29:10.880000+00:00        -20.000000        0.059907   \n",
       "1970-01-02 00:29:10.890000+00:00        -20.000000        0.058900   \n",
       "1970-01-02 00:29:10.900000+00:00        -20.000000        0.058422   \n",
       "1970-01-02 00:29:10.910000+00:00        -20.000000        0.058302   \n",
       "1970-01-02 00:29:10.920000+00:00        -20.000000        0.057891   \n",
       "1970-01-02 00:29:10.930000+00:00        -20.000000        0.057256   \n",
       "1970-01-02 00:29:10.940000+00:00        -20.000000        0.057648   \n",
       "1970-01-02 00:29:10.950000+00:00        -20.000000        0.057488   \n",
       "1970-01-02 00:29:10.960000+00:00        -20.000000        0.056879   \n",
       "\n",
       "                                  gaze_normal0_y  gaze_normal0_z  \\\n",
       "gaze_timestamp                                                     \n",
       "1970-01-02 00:29:10.770000+00:00        0.121556        0.984479   \n",
       "1970-01-02 00:29:10.780000+00:00        0.095046        0.987478   \n",
       "1970-01-02 00:29:10.790000+00:00        0.027374        0.997500   \n",
       "1970-01-02 00:29:10.800000+00:00        0.024890        0.997463   \n",
       "1970-01-02 00:29:10.810000+00:00        0.024500        0.997599   \n",
       "1970-01-02 00:29:10.820000+00:00        0.025140        0.997693   \n",
       "1970-01-02 00:29:10.830000+00:00        0.027284        0.997650   \n",
       "1970-01-02 00:29:10.840000+00:00        0.025921        0.997775   \n",
       "1970-01-02 00:29:10.850000+00:00        0.026011        0.997778   \n",
       "1970-01-02 00:29:10.860000+00:00        0.025339        0.997830   \n",
       "1970-01-02 00:29:10.870000+00:00        0.025130        0.997882   \n",
       "1970-01-02 00:29:10.880000+00:00        0.024893        0.997893   \n",
       "1970-01-02 00:29:10.890000+00:00        0.024917        0.997953   \n",
       "1970-01-02 00:29:10.900000+00:00        0.024264        0.997997   \n",
       "1970-01-02 00:29:10.910000+00:00        0.025038        0.997985   \n",
       "1970-01-02 00:29:10.920000+00:00        0.025402        0.997999   \n",
       "1970-01-02 00:29:10.930000+00:00        0.025568        0.998032   \n",
       "1970-01-02 00:29:10.940000+00:00        0.025339        0.998015   \n",
       "1970-01-02 00:29:10.950000+00:00        0.024511        0.998045   \n",
       "1970-01-02 00:29:10.960000+00:00        0.024088        0.998090   \n",
       "\n",
       "                                  eye_center1_3d_x  eye_center1_3d_y  \\\n",
       "gaze_timestamp                                                         \n",
       "1970-01-02 00:29:10.770000+00:00               NaN               NaN   \n",
       "1970-01-02 00:29:10.780000+00:00        -39.934928         14.997919   \n",
       "1970-01-02 00:29:10.790000+00:00        -39.934928         14.997919   \n",
       "1970-01-02 00:29:10.800000+00:00        -39.934928         14.997919   \n",
       "1970-01-02 00:29:10.810000+00:00        -39.934928         14.997919   \n",
       "1970-01-02 00:29:10.820000+00:00        -39.934928         14.997919   \n",
       "1970-01-02 00:29:10.830000+00:00        -39.934928         14.997919   \n",
       "1970-01-02 00:29:10.840000+00:00        -39.934928         14.997919   \n",
       "1970-01-02 00:29:10.850000+00:00        -39.934928         14.997919   \n",
       "1970-01-02 00:29:10.860000+00:00        -39.934928         14.997919   \n",
       "1970-01-02 00:29:10.870000+00:00        -39.934928         14.997919   \n",
       "1970-01-02 00:29:10.880000+00:00        -39.934928         14.997919   \n",
       "1970-01-02 00:29:10.890000+00:00        -39.934928         14.997919   \n",
       "1970-01-02 00:29:10.900000+00:00        -39.934928         14.997919   \n",
       "1970-01-02 00:29:10.910000+00:00        -39.934928         14.997919   \n",
       "1970-01-02 00:29:10.920000+00:00        -39.934928         14.997919   \n",
       "1970-01-02 00:29:10.930000+00:00        -39.934928         14.997919   \n",
       "1970-01-02 00:29:10.940000+00:00        -39.934928         14.997919   \n",
       "1970-01-02 00:29:10.950000+00:00        -39.934928         14.997919   \n",
       "1970-01-02 00:29:10.960000+00:00        -39.934928         14.997919   \n",
       "\n",
       "                                  eye_center1_3d_z  gaze_normal1_x  \\\n",
       "gaze_timestamp                                                       \n",
       "1970-01-02 00:29:10.770000+00:00               NaN             NaN   \n",
       "1970-01-02 00:29:10.780000+00:00        -20.075283       -0.145087   \n",
       "1970-01-02 00:29:10.790000+00:00        -20.075283       -0.150232   \n",
       "1970-01-02 00:29:10.800000+00:00        -20.075283       -0.152198   \n",
       "1970-01-02 00:29:10.810000+00:00        -20.075283       -0.151952   \n",
       "1970-01-02 00:29:10.820000+00:00        -20.075283       -0.150413   \n",
       "1970-01-02 00:29:10.830000+00:00        -20.075283       -0.151138   \n",
       "1970-01-02 00:29:10.840000+00:00        -20.075283       -0.150791   \n",
       "1970-01-02 00:29:10.850000+00:00        -20.075283       -0.149916   \n",
       "1970-01-02 00:29:10.860000+00:00        -20.075283       -0.149606   \n",
       "1970-01-02 00:29:10.870000+00:00        -20.075283       -0.150185   \n",
       "1970-01-02 00:29:10.880000+00:00        -20.075283       -0.149901   \n",
       "1970-01-02 00:29:10.890000+00:00        -20.075283       -0.149639   \n",
       "1970-01-02 00:29:10.900000+00:00        -20.075283       -0.149847   \n",
       "1970-01-02 00:29:10.910000+00:00        -20.075283       -0.149284   \n",
       "1970-01-02 00:29:10.920000+00:00        -20.075283       -0.148602   \n",
       "1970-01-02 00:29:10.930000+00:00        -20.075283       -0.148867   \n",
       "1970-01-02 00:29:10.940000+00:00        -20.075283       -0.148678   \n",
       "1970-01-02 00:29:10.950000+00:00        -20.075283       -0.148821   \n",
       "1970-01-02 00:29:10.960000+00:00        -20.075283       -0.148850   \n",
       "\n",
       "                                  gaze_normal1_y  gaze_normal1_z  \n",
       "gaze_timestamp                                                    \n",
       "1970-01-02 00:29:10.770000+00:00             NaN             NaN  \n",
       "1970-01-02 00:29:10.780000+00:00        0.230744        0.962137  \n",
       "1970-01-02 00:29:10.790000+00:00        0.224797        0.962738  \n",
       "1970-01-02 00:29:10.800000+00:00        0.229156        0.961410  \n",
       "1970-01-02 00:29:10.810000+00:00        0.234021        0.960284  \n",
       "1970-01-02 00:29:10.820000+00:00        0.234215        0.960478  \n",
       "1970-01-02 00:29:10.830000+00:00        0.233532        0.960531  \n",
       "1970-01-02 00:29:10.840000+00:00        0.233569        0.960577  \n",
       "1970-01-02 00:29:10.850000+00:00        0.233780        0.960662  \n",
       "1970-01-02 00:29:10.860000+00:00        0.233583        0.960758  \n",
       "1970-01-02 00:29:10.870000+00:00        0.233384        0.960716  \n",
       "1970-01-02 00:29:10.880000+00:00        0.233191        0.960808  \n",
       "1970-01-02 00:29:10.890000+00:00        0.233584        0.960753  \n",
       "1970-01-02 00:29:10.900000+00:00        0.233968        0.960627  \n",
       "1970-01-02 00:29:10.910000+00:00        0.234162        0.960668  \n",
       "1970-01-02 00:29:10.920000+00:00        0.234394        0.960717  \n",
       "1970-01-02 00:29:10.930000+00:00        0.234479        0.960655  \n",
       "1970-01-02 00:29:10.940000+00:00        0.234164        0.960761  \n",
       "1970-01-02 00:29:10.950000+00:00        0.234277        0.960712  \n",
       "1970-01-02 00:29:10.960000+00:00        0.234256        0.960712  "
      ]
     },
     "execution_count": 54,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data=pd.read_csv('gaze.csv')#读入数据\n",
    "data[\"gaze_timestamp\"] = pd.to_datetime(data[\"gaze_timestamp\"].values,unit = \"s\",utc=True)\n",
    "interval = str(1/100)+'S'\n",
    "data.index = pd.to_datetime(data.gaze_timestamp.values)\n",
    "data =data.resample(interval,on =\"gaze_timestamp\").mean()\n",
    "data.head(20)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "09b2fda8-2a74-4ed4-a94f-150c67e3165d",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
